import 'package:flutter/material.dart';
import 'package:flutter_home_manager/components/NavCol.dart';

class HomeNav extends StatefulWidget {
  HomeNav({Key? key}) : super(key: key);

  @override
  _HomeNavState createState() => _HomeNavState();
}

class _HomeNavState extends State<HomeNav> {
  List navList = [
    {'title': '我的房屋', 'icon': 'assets/images/house_nav_icon@2x.png'},
    {'title': '我的保修', 'icon': 'assets/images/repair_nav_icon@2x.png'},
    {'title': '登客记录', 'icon': 'assets/images/visitor_nav_icon@2x.png'},
  ];

  List<Widget> getNavListWidget() {                                                                                                   
    return navList.map((item) {
      return NavCol(icon: item["icon"], title: item['title']);
    }).toList();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.all(10),
      padding: EdgeInsets.only(top: 10, bottom: 10),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(10),
        color: Color(0xFFFF),
      ),
      child: Row(
        children: getNavListWidget(),
      ),
    );
  }
}
